export const getErrorMsg = (err: unknown): string => {
    let errMsg = '';
    if (err instanceof Error) {
        errMsg = err.message;
    } else {
        errMsg = 'unknown error occurred';
    }
    return errMsg;
};

export const mapToError = (err: unknown): Error => {
    let error: Error;
    if (err instanceof Error) {
        error = err;
    } else {
        error = new Error('unknown error occurred');
    }
    return error;
};
